<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">


    <title>Title</title>

    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/jquery.min.js"></script>
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/js/jquery-easyui-1.5.1/themes/default/easyui.css">
    <link rel="stylesheet" href="__PUBLIC__/js/jquery-easyui-1.5.1/themes/icon.css">
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/plugins/jquery.layout.js"></script>


</head>
<body>
<div id="cc" class="easyui-layout"  fit="true">
    <div data-options="region:'north',title:'North Title',noheader:true" style="height:100px;">

        <a href="#"  id="login_btn" onclick="javascript:$('#pp').panel('open')">登录</a>
        <div id="loginout_div">
            <label id="userinfo" ></label>
            <a href="{:U('Index/Index/Loginout')}"  id="loginout_btn" >登出</a>
        </div>


        <!--   登录的界面的代码                          -->
        <div id="pp" class="easyui-window" title="My Window" closed="true" style="width:380px;height:250px"
             data-options="iconCls:'icon-save',modal:true" >
            <form style="padding:10px 20px 10px 40px;">
                <p>Name: <input type="text" id="login_username" name="login_username"></p>
                <p>Pass: <input type="password" id="login_pwd"  name="login_pwd"></p>
                <p>Pass: <input type="text" id="login_verify" name="login_verify">
                    <img id="imgvcode" onclick="refresh()" src="{:U('Index/Index/verify')} ">
                    <a href="#" onclick="refresh()">看不清</a>
                 </p>
                <div style="padding:5px;text-align:center;">
                    <a href="#" class="easyui-linkbutton" id="w_login_btn"  icon="icon-ok">Ok</a>
                    <a href="#" class="easyui-linkbutton" icon="icon-cancel">Cancel</a>
                </div>
            </form>
        </div>
        <!--   登录的界面的代码                          -->
    </div>


    <div data-options="region:'west',title:'West',split:true" style="width:200px;">
        <ul class="easyui-tree">
            <li>
                <span>菜单</span>
                <ul>
                    <li class="menu-item"><a href="index.php?p=admin&c=category&a=index" target="main-frame">商品分类</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=brand&a=index" target="main-frame">商品品牌</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=type&a=index" target="main-frame">商品类型</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=goods&a=add" target="main-frame">添加新商品</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=goods&a=index" target="main-frame">商品列表</a></li>
                </ul>
            </li>
            <li>
                <span>菜单2</span>
                <ul>
                    <li class="menu-item"><a href="index.php?p=admin&c=category&a=index" target="main-frame">商品分类</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=brand&a=index" target="main-frame">商品品牌</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=type&a=index" target="main-frame">商品类型</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=goods&a=add" target="main-frame">添加新商品</a></li>
                    <li class="menu-item"><a href="index.php?p=admin&c=goods&a=index" target="main-frame">商品列表</a></li>
                </ul>
            </li>

        </ul>
    </div>
    <div data-options="region:'center',title:'center title' "  border="false" noheader="true" style="padding:5px;background:#eee;">
        <div id="tt" class="easyui-tabs" fit="true" style="width:500px;height:250px;">
            <div title="Tab1"  href="{:U('Show/Show')}" style="padding:20px;display:none;">
                tab1
            </div>

        </div>
    </div>
</div>

</body>
<script>




    function mysubmit() {


    }

//刷新验证码
    function refresh() {
        $("#imgvcode").attr("src", "{:U('Index/Index/verify')}" + "?rid=" + Math.random());

    }

    function getUserinfo() {
        $.get(
            "{:U('Index/Index/getUserInfo')}",
            function(result){
              if(result['uid']!=null){
                  $("#login_btn").hide();
                  $("#userinfo").text(result['username']+",你好");
                  $("#loginout_div").show();
              }
              else {
                  $("#login_btn").show();
                  $("#loginout_div").hide();
              }

            });


    }
    $(function () {

        $('#w_login_btn').click(function () {

            var _login_username=$('#login_username').val();
            var _login_userpwd=$('#login_pwd').val();
            var _login_verify=$('#login_verify').val();

            $.post("{:U('Index/Index/Login')}",{username:_login_username,userpwd:_login_userpwd,verify:_login_verify},
                function (data) {
                    alert(data.msg);
                    if(data.status!='error'){
                        getUserinfo();
                        $('#pp').window('close');
                        $('#login_btn').hide();

                        return;
                    }
                    else {
                        refresh();
                        return;
                    }
		


                },'json')
        })

        $("#loginout_div").hide();
        $("#login_btn").hide();

        getUserinfo();
    });



</script>
</html>